<style>
    .layui-form-item .layui-input-company {width: auto;padding-right: 10px;line-height: 38px;}
</style>
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">

        <div class="layui-form layuimini-form">
			 <input type="hidden" name="id" value="{{.systemSetting.Id}}" >
            <div class="layui-form-item">
                <label class="layui-form-label required">网站名称</label>
                <div class="layui-input-block">
                    <input type="text" name="web_name" lay-verify="required" lay-reqtext="网站名不能为空" placeholder="请输入网站名称"  value="{{.systemSetting.WebName}}" class="layui-input">
                    <tip>填写自己部署网站的名称。</tip>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label required">网站首页</label>
                <div class="layui-input-block">
                    <input type="text" name="portal_url" lay-verify="required" lay-reqtext="网站首页不能为空" placeholder="请输入网站首页url"  value="{{.systemSetting.PortalUrl}}" class="layui-input">
                </div>
            </div>
           
            <div class="layui-form-item">
                <label class="layui-form-label">最大文件上传</label>
                <div class="layui-input-inline" style="width: 80px;">
                    <input type="text" name="file_max_size" lay-verify="number" value="{{.systemSetting.FileMaxSize}}" class="layui-input">
                </div>
                <div class="layui-input-inline layui-input-company">KB</div>
                <div class="layui-form-mid layui-word-aux">提示：1 M = 1024 KB</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上传文件类型</label>
                <div class="layui-input-block">
                    <input type="text" name="file_types" placeholder="上传文件类型 png|gif|jpg|jpeg|zip|rar" value="{{.systemSetting.FileTypes}}" class="layui-input">
                </div>
            </div>
			
			<div class="layui-form-item layui-form-text">
                <label class="layui-form-label">系统公告</label>
                <div class="layui-input-block">
                    <textarea name="gonggao" class="layui-textarea">{{.systemSetting.Gonggao}}</textarea>
                </div>
            </div>
			
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">网站备案号</label>
                <div class="layui-input-block">
                    <input type="text" name="record" value="{{.systemSetting.Record}}" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">统计代码</label>
                <div class="layui-input-block">
                    <textarea name="tongji" class="layui-textarea">{{.systemSetting.Tongji}}</textarea>
                </div>
            </div>
           
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">版权信息</label>
                <div class="layui-input-block">
                    <textarea name="powerby" class="layui-textarea">{{.systemSetting.Powerby}}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="setting">确认保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form
            , layer = layui.layer;
		$ = layui.$;
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //监听提交
        form.on('submit(setting)', function (data) {
            /*parent.layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            });*/
			var url = "/admin/systemSet"
            $.post(url,data.field,function(resp){
				
				if(resp.code == 0){
					//成功
					layer.msg("编辑成功",{end:function(){
						location.reload();
						// 关闭弹出层
						// layer.closeAll();
					}});
					
				}else{
					layer.msg(resp.msg);
				}
		    },"json");
			
            return false;
        });

    });
</script>